﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    


<head>
<style type="text/css">  
        .datagrid-header-rownumber,.datagrid-cell-rownumber{  
            width:50px;  
        }  
</style> 
	<script type="text/javascript" src="<c:url value='/easyui/datagrid-scrollview.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/js/queryesinfo.js'/>"></script>
	<SCRIPT language=JAVASCRIPT src='<c:url value="/js/grid.js"/>'></SCRIPT>	
	<script type="text/javascript">
	var twice = ${cfgs["fontsizetwice"]};
	var fontsize = 12;
	var lineheight = 18;
	
	function dgfontsizechange(){
		if (twice > 1){
			
			$(".datagrid-row .datagrid-cell").css("font-size", fontsize*twice+ "px");
			$(".datagrid-row .datagrid-cell").css("line-height", lineheight*twice + "px");

			$(".datagrid-cell-rownumber").css("font-size", fontsize*twice + "px");
			$(".datagrid-cell-rownumber").css("height", lineheight*twice + "px");
			$(".datagrid-cell-rownumber").css("line-height", lineheight*twice + "px");
      
    		
			$('.datagrid div').each(function(i){
				   var classname = $(this).attr('class');
				   if (classname.indexOf('datagrid-')!=-1){
				   	    var newwidth = $(this).attr("oldwidth");
				   	    
				   	    if (newwidth == undefined) {				   	    	
                    newwidth = $(this).css("width");
                    $(this).attr("oldwidth",newwidth);
                    
                }
                
                var newwidth = parseFloat(newwidth) * twice;
				   	    $(this).css('width',newwidth);
				   	}
				   	
    		})
			
			
		}
		}
	
	var showflag = false;
	$(document).keypress(function(e) {
	    if ( e.which == 13 ) {
	    	showUnitname();
	    };
	});
	
	
	function showUnitname(){
		if (showflag == false){
    		$('#t-dg').datagrid('showColumn','unitname');
    	  showflag = true;
    	}else{
    		$('#t-dg').datagrid('hideColumn','unitname');
    		showflag = false;
    	}
	}
	
		$(function(){
				init();
		});
		
			function init(){
				$('#t-dg').datagrid({
					loadMsg:'正在加载',
					onLoadSuccess:function(data){
						dgfontsizechange();
					},
	                rowStyler:function(index,row){  
	                	if(row.timeout == 0){   			        	
				        	if (row.usr_op_type == '新增')
				        	    return 'background-color:${cfgs["newbgcolor"]};color:${cfgs["newfgcolor"]};font-weight:bold;';
				        	else
				        		return 'background-color:${cfgs["updbgcolor"]};color:${cfgs["updfgcolor"]};font-weight:bold;';			        	
			            } else {
			            	if(row.timeout > 182)
			            		return 'background-color:${cfgs["expbgcolor"]};color:${cfgs["expfgcolor"]};font-weight:bold;';
			            	else
			            		return 'background-color:${cfgs["ptbgcolor"]};color:${cfgs["ptfgcolor"]};font-weight:bold;';
			            }   
			        },
					view:scrollview,  
	                pageSize:50,
	                onDblClickRow:function(rowIndex, rowData){
	                	viewItem();
	                }
				
			});
				
			}

		
			function viewItem(){
				var t = $('#t-dg');
				if (isSingleSelect(t)){
				var row = t.datagrid('getSelected');
				if (row){
					parent.parent.open2('<c:url value="/read/other/showOtherEstateInfo"/>?id=' + row.id,'房源编号：'+row.local_id);
					
					
					
				}
				}
				
				
			}

		
		function doQuery(value){
			$('#t-dg').datagrid('load', {
				q: value
			});
		}
		
       function advanceQuery(){
			
			showQueryDialog('<c:url value="/"/>','组合查询', function(data){
				$('#t-dg').datagrid('load',data);
			});
		}
		
		function advanceOrder(){
			showOrderDialog('<c:url value="/"/>','排序方式', function(data){
				$('#t-dg').datagrid({
					orderName:data.orderName,
					sortName:data.sortName
				});
			});
		}
	</script>
</head>
<body>
	<div class="easyui-layout" fit="true">
		<div region="north" border="false" style="height:40px;padding:5px;overflow:hidden;">
			<div style="padding-top:3px;float:left"><input type="checkbox" name="" class="easyui-validatebox" onclick="showUnitname();"/></div>
		<div style="float:left;padding-top:5px">
		显示&nbsp;
		</div>
			<div style="padding-top:3px;float:left">
			<input class="easyui-searchbox" prompt="按方式|地址进行查询" searcher="doQuery" style="width:300px"></input>
		</div>
		<div style="float:left">			
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="advanceQuery()">组合查询</a>		    
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="advanceOrder()">排序方式</a>		    
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="viewItem()">详细信息</a>		
		</div>
	</div>
		
		
		<div region="center" border="true">
			<table id="t-dg" style="display:none;"
					url="<c:url value='/read/other/getEstate2Items'/>"
					singleSelect="true" rownumbers="true" 
					border="false" fit="true" >
				<thead>
					<tr>
<c:if test="${fieldscount == 0 }">					
<th field="unitname" width="100" sortable="true" hidden="false">单位名称</th>					
						<th field="local_id" width="100" sortable="true">房源编号</th>
<th field="selfcode" width="100" sortable="false">自编号</th>
<th field="editdate" width="100" sortable="true">录入时间</th>
<th field="mode" width="100" sortable="true">方式</th>
<th field="address" width="100" sortable="true">地址</th>
<th field="circs" width="100" sortable="true">手续</th>
<th field="purpose" width="100" sortable="true">类别</th>
<th field="layer" width="100" sortable="true">楼层</th>
<th field="direction" width="100" sortable="false">方向</th>
<th field="room" width="100" sortable="true">规格</th>
<th field="area" width="100" sortable="true">面积</th>
<th field="price" width="100" sortable="true">价格</th>
<th field="unit" width="100" sortable="false">价格单位</th>
<th field="totalprice" width="100" sortable="true">总价</th>
<th field="phone_flag" width="100" sortable="false">电话</th>
<th field="scheduled_flag" width="100" sortable="false">钥匙</th>
<th field="memo" width="100" sortable="false">备注</th>
<th field="oper" width="100" sortable="false">操作人员</th>
<th field="displayhint" width="100" sortable="true">显示限制</th>
<th field="fitment" width="100" sortable="false">装修</th>
<th field="wg" width="100" sortable="false">外观</th>
<th field="qt" width="100" sortable="false">其它</th>
<th field="sj" width="100" sortable="false">实价</th>
<th field="usr_op_type" width="100" sortable="true">信息类型</th>
</c:if>
<c:forEach items="${fields}" var="field" varStatus="status">
  <th field="${field.field}" width="${field.width}" sortable="true" 
  <c:if test="${field.ishidden==1}">
  hidden="false"
  </c:if>
  >${field.showtitle }</th>
</c:forEach>

					</tr>
				</thead>
			</table>
		</div>
	</div>
	



	

</body>
